//
//  ZStatusBottomView.m
//  OC-weibo
//
//  Created by zero on 17/3/24.
//  Copyright © 2017年 zero. All rights reserved.
//

#import "ZStatusBottomView.h"

@interface ZStatusBottomView()

//  转发按钮

@property (nonatomic,weak)UIButton *btnRetweet;
//  评论按钮

@property (nonatomic,weak)UIButton *btnComment;
//  点赞按钮

@property (nonatomic,weak)UIButton *btnUnlike;



@end

@implementation ZStatusBottomView

#pragma mark
#pragma mark - 重写init方法
- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        //  布局
        [self setupUI];
    }
    
    return self;
}

#pragma mark
#pragma mark - 布局
- (void)setupUI{
 
    UIButton *btnRetweet = [UIButton z_buttonWithNormalImageName:@"timeline_card_bottom_background" andHighLightedImageName:@"timeline_card_bottom_background_highlighted" andSelectedImageName:nil andImage:@"timeline_icon_retweet" andImageSelectedName:nil andTitle:@"转发" andFrame:CGRectZero];
    
    [btnRetweet setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    btnRetweet.titleLabel.font = [UIFont systemFontOfSize:10];
    self.btnRetweet = btnRetweet;
    
    UIButton *btnComment = [UIButton z_buttonWithNormalImageName:@"timeline_card_bottom_background" andHighLightedImageName:@"timeline_card_bottom_background_highlighted" andSelectedImageName:nil andImage:@"timeline_icon_comment" andImageSelectedName:nil andTitle:@"评论" andFrame:CGRectZero];
    
    [btnComment setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    btnComment.titleLabel.font = [UIFont systemFontOfSize:10];
    self.btnComment = btnComment;
    
    UIButton *btnUnlike = [UIButton z_buttonWithNormalImageName:@"timeline_card_bottom_background" andHighLightedImageName:@"timeline_card_bottom_background_highlighted" andSelectedImageName:nil andImage:@"timeline_icon_unlike" andImageSelectedName:nil andTitle:@"赞" andFrame:CGRectZero];
    
    [btnUnlike setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    btnUnlike.titleLabel.font = [UIFont systemFontOfSize:10];
    self.btnUnlike = btnUnlike;
    
    [self addSubview:btnRetweet];
    [self addSubview:btnComment];
    [self addSubview:btnUnlike];
    
    //  约束
    
    CGFloat buttonW = [UIScreen mainScreen].bounds.size.width / 3;
    
    [btnRetweet mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.leading.bottom.equalTo(self);
        
        make.size.mas_equalTo(CGSizeMake(buttonW, 35));
    }];
    
    [btnComment mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.leading.equalTo(btnRetweet.mas_trailing);
        make.top.bottom.equalTo(self);
        make.size.equalTo(btnRetweet);
    }];
    
    [btnUnlike mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.bottom.trailing.equalTo(self);
        make.leading.equalTo(btnComment.mas_trailing);
        make.height.equalTo(btnRetweet);
    }];
    
    
    // 分割线
    UIImageView *line = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"timeline_card_bottom_line"]];
    
    [self addSubview:line];
    
    //  约束
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(btnRetweet);
        make.leading.equalTo(btnRetweet.mas_trailing);
    }];
    
    // 分割线
    UIImageView *line1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"timeline_card_bottom_line"]];
    
    [self addSubview:line1];
    
    //  约束
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(btnComment);
        make.leading.equalTo(btnComment.mas_trailing);
    }];
    
    
    
}

@end
